package com.le.buddha.websocket;

import cn.hutool.json.JSONUtil;
import com.le.buddha.common.Response;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

/**
 * @author guole
 * @created 2025/1/12
 */
public class SocketEncoder  implements Encoder.Text<Response> {
    @Override
    public String encode(Response response) throws EncodeException {
        return JSONUtil.toJsonStr(response);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}
